﻿using Volo.Abp.Caching;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;

namespace mozhi.smarterp.Finance
{
    public class DistributedCacheRepository<TDbContext, TEntity, TKey> : EfCoreRepository<TDbContext, TEntity, TKey>
        where TDbContext : IEfCoreDbContext where TEntity : class, IEntity<TKey>
    {
        protected readonly IDistributedCache<TEntity> _distributedCache;

        public DistributedCacheRepository(IDbContextProvider<TDbContext> dbContextProvider, IDistributedCache<TEntity> distributedCache) : base(dbContextProvider)
        {
            this._distributedCache = distributedCache;
        }
    }




    public class CustomDistributedCacheKey
    {
        private ICurrentTenant _tenant;

        public CustomDistributedCacheKey(ICurrentTenant tenant) { this._tenant = tenant; }

        public override string ToString()
        {
            return $"{_tenant.Id}";
        }
    }
}
